﻿/*
 *GreyBox was written by Strategic Data Systems and licenced under the open source MS-PL. 
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace StrategicDataSystems.Cloud.Monitoring.HostedServices.ResponseToEntityMappers
{
    public class HostedServiceListResponseMapper
    {

        public IEnumerable<string> MapToEntity(XDocument responseXml)
        {
            XNamespace azureNamespace = XNamespace.Get("http://schemas.microsoft.com/windowsazure");

            IEnumerable<string> hostedServiceUrls = from serviceElement in responseXml.Descendants(azureNamespace + "HostedService")
                                    select serviceElement.Element(azureNamespace + "Url").Value;

            return hostedServiceUrls;
        }

    }
}
